package cn.threewaters.qtyy.config.dyds;

import java.sql.SQLException;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Primary;

import com.alibaba.druid.pool.DruidDataSource;

import lombok.extern.slf4j.Slf4j;

//@Configuration
//@MapperScan(value = { "cn.threewaters.qtyy.dit", "cn.threewaters.qtyy.dic" })
@Slf4j
public class DataSourceConfig {
	@ConfigurationProperties(prefix = "datasource1")
	@Bean(name = "datasource1")
	@Primary
	public DruidDataSource dataSource1() throws SQLException {
		DruidDataSource druidDataSource = new DruidDataSource();
		log.info("数据源1初始化成功");
		return druidDataSource;
	}

	@ConfigurationProperties(prefix = "datasource2")
	@Bean(name = "datasource2")
	public DruidDataSource dataSource2() throws SQLException {
		DruidDataSource druidDataSource = new DruidDataSource();
		log.info("数据源2初始化成功");
		return druidDataSource;
	}

}
